/*    */ package com.qmsk.business.member.customerCarInfo.controller;
/*    */ 
/*    */ import com.qmsk.business.member.customerCarInfo.dao.CustomerCarInfoDAO;
/*    */ import com.utils.gson.in.ParserDataSetJson;
/*    */ import com.utils.gson.out.GsonEbRst;
/*    */ import com.utils.web.RequestUtils;
/*    */ import com.utils.web.ResponseUtils;
/*    */ import java.sql.SQLException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import org.apache.log4j.Logger;
/*    */ import org.springframework.beans.factory.annotation.Autowired;
/*    */ import org.springframework.stereotype.Controller;
/*    */ import org.springframework.web.bind.annotation.PathVariable;
/*    */ import org.springframework.web.bind.annotation.RequestMapping;
/*    */ 
/*    */ @Controller
/*    */ @RequestMapping({"/customerCarInfo"})
/*    */ public class CustomerCarInfoController
/*    */ {
/* 29 */   private static final Logger logger = Logger.getLogger(CustomerCarInfoController.class);
/*    */ 
/*    */   @Autowired
/*    */   private CustomerCarInfoDAO dao;
/*    */ 
/*    */   @RequestMapping(value={"find/customerCarInfo/{openId}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*    */   public void getListOfCarTypeId(HttpServletRequest request, HttpServletResponse response, @PathVariable("openId") String openId)
/*    */   {
/*    */     try
/*    */     {
/* 39 */       GsonEbRst gsonEbRst = this.dao.getGsonOfOpenId(openId);
/* 40 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*    */     } catch (SQLException e) {
/* 42 */       logger.error(e);
/* 43 */       ResponseUtils.setErrorMsgResponse(
/* 44 */         RequestUtils.getFindDataErrorMessage(request), response);
/*    */     }
/*    */   }
/*    */ 
/*    */   @RequestMapping(value={"find/custId/{custId}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*    */   public void getListOfCustId(HttpServletRequest request, HttpServletResponse response, @PathVariable("custId") Long custId)
/*    */   {
/*    */     try
/*    */     {
/* 53 */       GsonEbRst gsonEbRst = this.dao.getCarInfoOfCustId(custId);
/* 54 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*    */     } catch (SQLException e) {
/* 56 */       logger.error(e);
/* 57 */       ResponseUtils.setErrorMsgResponse(
/* 58 */         RequestUtils.getFindDataErrorMessage(request), response);
/*    */     }
/*    */   }
/*    */ 
/*    */   @RequestMapping(value={"edit"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*    */   public void insertInfo(HttpServletRequest request, HttpServletResponse response)
/*    */   {
/*    */     try
/*    */     {
/* 67 */       int nResult = 0;
/* 68 */       String sData = RequestUtils.getStringOfData(request);
/* 69 */       ParserDataSetJson p = ParserDataSetJson.fromString(sData);
/* 70 */       if ((p != null) && (p.isExistsUpdateRows())) {
/* 71 */         nResult = this.dao.applyUpdates(p);
/*    */       }
/*    */       else {
/* 74 */         ResponseUtils.setErrorMsgResponse(
/* 75 */           RequestUtils.getReadDataErrorMessage(request), 
/* 76 */           response);
/* 77 */         return;
/*    */       }
/* 79 */       if (nResult > 0)
/* 80 */         this.dao.commit();
/*    */       else {
/* 82 */         this.dao.rollback();
/*    */       }
/* 84 */       ResponseUtils.setSqlResultResponse(nResult, 
/* 85 */         RequestUtils.getSqlInsertDataErrorMessage(request), 
/* 86 */         response);
/*    */     }
/*    */     catch (Exception e) {
/* 89 */       logger.error(e);
/* 90 */       ResponseUtils.setErrorMsgResponse(
/* 91 */         RequestUtils.getSqlInsertDataErrorMessage(request) + ":" + 
/* 92 */         e.getMessage(), response);
/*    */     }
/*    */   }
/*    */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.member.customerCarInfo.controller.CustomerCarInfoController
 * JD-Core Version:    0.5.3
 */